import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: ()=>import('../views/home.vue'),
    children: [
      {
        path: '/admin',
        name: 'Admin',
        component: Main,
        meta:{
          is:true,
          extraName:"首页"
        }
      },
      {
        path: 'user',
        name: 'User',
        component: User,
        meta:{
          is:true,
          extraName:"用户管理"
        }
      },
      {
        path: 'order',
        name: 'Order',
        component: Order,
        meta:{
          is:true,
          extraName:"订单管理"
        }

      },
      {
        path: 'cashier',
        name: 'Cashier',
        component: Cashier,
        meta:{
          is:true,
          extraName:"收银订单"
        }
      },
      {
        path: 'sale',
        name: 'Sale',
        component: Sale,
        meta:{
          is:true,
          extraName:"售后订单"
        }
      },
      {
        path: 'update',
        name: 'Update',
        component: Update,
        meta:{
          is:true,
          extraName:"编辑订单"
        }
      },
      {
        path: 'administrator',
        name: 'Administrator',
        component: Administrator,
        meta:{
          is:true,
          extraName:"管理员列表"
        }
      },
      {
        path: 'role',
        name: 'Role',
        component: Role,
        meta:{
          is:true,
          extraName:"角色管理"
        }
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
